#include "QWebCamStudioLite.h"

#include <QtGui/QLabel>
#include <QtGui/QMenu>
#include <QtGui/QMenuBar>
#include <QtGui/QAction>

#include "v4l/v4ldevicesfinder.h"

#include <QDebug>
QWebCamStudioLite::QWebCamStudioLite()
{
  qDebug() << "System Tray Available: " << QSystemTrayIcon::isSystemTrayAvailable ();
  tray = new QSystemTrayIcon(QIcon::fromTheme("camera-web"), this);
//   QMenu trayIconMenu(this);
//   trayIconMenu.addAction("azione");
//   tray.setContextMenu(&trayIconMenu);
  tray->show();
  connect(tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(systemTrayActivated(QSystemTrayIcon::ActivationReason)));
  this->hide();
  
  V4LDevicesFinder devicesFinder;
  devicesFinder.searchDevices();
}

QWebCamStudioLite::~QWebCamStudioLite()
{}


void QWebCamStudioLite::systemTrayActivated(QSystemTrayIcon::ActivationReason reason)
{
  if(reason == QSystemTrayIcon::DoubleClick) this->setVisible(!this->isVisible());
}


#include "QWebCamStudioLite.moc"
